package org.apache.flink.runtime.resourceconsumer;

import static org.apache.flink.util.Preconditions.checkNotNull;

import org.apache.flink.runtime.clusterframework.types.ResourceID;
import org.apache.flink.runtime.registration.RegistrationResponse;
import org.apache.flink.runtime.resourcemanager.ResourceManagerId;

/** Base class for responses from the ResourceManager to a registration attempt by a ResourceConsumer. */
public class ResourceConsumerRegistrationSuccess extends RegistrationResponse.Success {

    private static final long serialVersionUID = 5577641250204140415L;

    private final ResourceManagerId resourceManagerId;

    private final ResourceID resourceManagerResourceId;

    public ResourceConsumerRegistrationSuccess(
            final ResourceManagerId resourceManagerId, final ResourceID resourceManagerResourceId) {
        this.resourceManagerId = checkNotNull(resourceManagerId);
        this.resourceManagerResourceId = checkNotNull(resourceManagerResourceId);
    }

    public ResourceManagerId getResourceManagerId() {
        return resourceManagerId;
    }

    public ResourceID getResourceManagerResourceId() {
        return resourceManagerResourceId;
    }

    @Override
    public String toString() {
        return "ResourceConsumerRegistrationSuccess{"
                + "resourceManagerId="
                + resourceManagerId
                + ", resourceManagerResourceId="
                + resourceManagerResourceId
                + '}';
    }
}
